#include<bits/stdc++.h>
using namespace std;
int intcmp(const void * a , const void * b){
	int ia = * ((int * ) a);
	int ib = * ((int * ) b);
	return ib - ia;
}
int main(){
	freopen("kaj.in","r",stdin);
	freopen("kaj.out","w",stdout);
	int w , n , ans;
	cin >> w;
	cin >> n;
	int * t = (int *)malloc(sizeof(int) * n);
	for(int i = 0 ; i < n ; i++){
		cin >> t[i];
	}
	//cout << w << endl;
	//cout << n << endl;
	qsort(t , n , sizeof(int) , intcmp);
	//for(int i = 0 ; i < n ; i++){
	//	cout << t[i] << endl;
	//}
	int *start , *end;
	start = t;
	end = t + n - 1;
	ans = 0;
	while(start <= end){
		if(*start + *end <= w){
			ans = ans + 1;
			start = start + 1;
			end = end - 1;
		}
		else{
			ans = ans + 1;
			start = start + 1;
		}
	}
	cout << ans << endl;
	return 0;
}
